InĀ [1]:
import importlib
import src.plots

importlib.reload(src.plots)
Out[1]:
<module 'src.plots' from '/Users/milenaangelova/git-repo/FedCluLearn/src/plots.py'>
InĀ [2]:
from src.plots import plot_plotly, preprocessing_results
InĀ [3]:
local_FedAtt = 'results/results_FedAtt_2025-02-26 13:25:19.867217.txt'
global_FedAtt = 'results/global_model_evaluation_FedAtt_2025-02-26 13:25:19.867217.txt'
local_FedProx = 'results/results_FedProx_2025-02-26 13:25:13.689653.txt'
global_FedProx = 'results/global_model_evaluation_FedProx_2025-02-26 13:25:13.689653.txt'
local_FedAvg = 'results/results_FedAvg_2025-02-26 13:29:55.229671.txt'
global_FedAvg = 'results/global_model_evaluation_FedAvg_2025-02-26 13:29:55.229671.txt'
local_FedCluLearn = 'results/results_FedCluLearn_2025-02-26 13:46:34.610555.txt'
global_FedCluLearn = 'results/global_model_evaluation_FedCluLearn_2025-02-26 13:46:34.610555.txt'
local_FedCluLearn_Prox = 'results/results_FedCluLearn_Prox_2025-02-26 13:47:10.790761.txt'
global_FedCluLearn_Prox = 'results/global_model_evaluation_FedCluLearn_Prox_2025-02-26 13:47:10.790761.txt'
InĀ [4]:
local_filenames = [local_FedCluLearn, local_FedAvg, local_FedAtt, local_FedProx, local_FedCluLearn_Prox]
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
InĀ [5]:
mse_column = 'mse'
n_rounds, y = preprocessing_results(filenames=local_filenames, mse_column=mse_column)
plot_plotly(n_rounds, y, title='Avg MSE Local models', y_axis_title=f'{mse_column.upper()} error', y_axis_max=0.3)
InĀ [6]:
for client_id in [0,1,2]:
    n_rounds, y = preprocessing_results(filenames=local_filenames, client_id=client_id, mse_column='mse')
    plot_plotly(n_rounds, y, title=f'MSE Local model Client {client_id}', y_axis_title='MSE error')
InĀ [7]:
mse_column = 'mse'
# n_rounds, y = preprocessing_results(filenames=[global_FedCluLearn, global_FedCluLearn_recent, global_FedCluLearn_percentage, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox, global_FedCluLearn_Prox_recent, None], mse_column=mse_column)
# global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
#Avg {mse_column.upper()} Global model
plot_plotly(n_rounds, y, title=f'Global model', y_axis_title=f'{mse_column.upper()}', y_axis_max=1)
InĀ [8]:
mse_column = 'r2'
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Global model', y_axis_title=f'{mse_column.upper()}', y_axis_max=1)
InĀ [9]:
mse_column='mse'
for client_id in [0,1,2]:
    n_rounds, y = preprocessing_results(filenames=global_filenames, client_id=client_id,mse_column=mse_column)
    plot_plotly(n_rounds, y, title=f'Global model - test data Client {client_id}', y_axis_title=f'{mse_column} error')
InĀ [10]:
mse_column='r2'
for client_id in [0,1,2]:
    n_rounds, y = preprocessing_results(filenames=global_filenames, client_id=client_id,mse_column=mse_column)
    plot_plotly(n_rounds, y, title=f'Global model - test data Client {client_id}', y_axis_title=f'{mse_column} error')
InĀ [11]:
mse_column='mse'
for client_id in [0,1,2]:
    n_rounds, y = preprocessing_results(filenames=[local_FedCluLearn, global_FedCluLearn, None, None, None], client_id=client_id,mse_column=mse_column)
    plot_plotly(n_rounds, y, title=f'Local vs Global Client {client_id}', y_axis_title=f'{mse_column} error', algo_name1='Local FedCluLearn', algo_name4='Global FedCluLearn')